package landx.toolkit.display
{
	import flash.display.DisplayObject;
	import flash.display.DisplayObjectContainer;
	import flash.display.Graphics;
	import flash.display.Sprite;
	
	import landx.toolkit.Console;

	/**
	 * 动态中心点类
	 */	
	public class DynamicSprite extends Sprite
	{
		private var m_content:Sprite=new Sprite();
		private var m_data:Object=null;
		public function DynamicSprite()
		{
			super.addChild(m_content);
		}
		
		override public function addChild(child:DisplayObject):DisplayObject{
			return content.addChild(child);
		}
		
		override public function addChildAt(child:DisplayObject, index:int):DisplayObject{
			return content.addChildAt(child,index);
		}
		
		override public function removeChild(child:DisplayObject):DisplayObject{
			return content.removeChild(child);
		}
		
		override public function removeChildAt(index:int):DisplayObject{
			return content.removeChildAt(index);
		}
		
		override public function removeChildren(beginIndex:int=0, endIndex:int=int.MAX_VALUE):void{
			content.removeChildren(beginIndex, endIndex);
		}
		
		override public function getChildAt(index:int):DisplayObject{
			return content.getChildAt(index);
		}
		
		override public function getChildByName(name:String):DisplayObject{
			return content.getChildByName(name);
		}
		
		override public function getChildIndex(child:DisplayObject):int{
			return content.getChildIndex(child);
		}
		
		/**
		 *获取当前的承载容器 
		 * @return 
		 */		
		public function get content():Sprite{
			return m_content;
		}
		
		/**
		 * 设置中心点x 
		 * @param n
		 */		
		public function set dx(n:Number):void{
			content.x=-n;
		}
		
		public function get dx():Number{
			return -content.x;
		}
		
		/**
		 * 设置中心点y 
		 * @param n
		 */		
		public function set dy(n:Number):void{
			content.y=-n;
		}
		
		public function get dy():Number{
			return -content.y;
		}
		
		/**
		 *附加数据 
		 * @param v
		 */		
		public function set data(v:Object):void{
			m_data=v;
		}
		
		public function get data():Object{
			return m_data;
		}
		
	}
}